package user

import (
	"context"
	"gf-xb-api/internal/model/dto"
	"gf-xb-api/internal/service"

	v1 "gf-xb-api/api/user/v1"
)

func (c *ControllerV1) GetUserLoginInfo(ctx context.Context, req *v1.GetUserLoginInfoReq) (res *v1.GetUserLoginInfoRes, err error) {

	output, err := service.User().GetUserInfo(ctx, &dto.UserLoginInput{
		Username: req.Username,
		Password: req.Password,
	})

	if err != nil {
		return nil, err
	}

	res = &v1.GetUserLoginInfoRes{
		Id:   output.Id,
		Uuid: output.Uuid,
	}

	return res, nil
}
